package gdt.dao.jpa;

import gdt.dao.CategoryDAO;
import gdt.entity.Category;
import gdt.entity.Project;

public class JPACategoryDAO extends JPAGenericDAO<Category, Long> implements CategoryDAO {

	public Category findByProjectAndName(Project project, String name) {
		return (Category) getEntityManager().createNamedQuery("findCategoryByProjectAndName").setParameter("project", project).setParameter("name", name).getSingleResult();
	}

	public Category findByCategoryAndName(Category category, String name) {
		return (Category) getEntityManager().createNamedQuery("findCategoryByCategoryAndName").setParameter("category", category).setParameter("name", name).getSingleResult();
	}

}
